#include <iostream>

using namespace std;

int main() {
    int n;
    int X, Y;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> X >> Y;
        if (X < Y) {
            cout << "NO BRAINS" << endl;
        }
        else {
            cout << "MMM BRAINS" << endl;
        }
    }
    return 0;
}
